<template>
  <el-drawer
    :title="$t('message.ddxq')"
    :visible.sync="isShow"
    :wrapper-closable="!modalDialog"
    size="1000px"
  >
    <div class="property-title">{{ $t('message.ddxq') }}</div>
    <div class="df_ac">
      <div class="item">
        <span class="key">{{ $t('message.ddbh') }}：</span>
        <span class="value">{{ detail.orderId }}</span>
      </div>
      <div class="item">
        <span class="key">{{ $t('message.ddzt') }}：</span>
        <span>{{ detail.orderStatus }}</span>
      </div>
      <div class="item">
        <span class="key">{{ $t('message.xdsj') }}：</span>
        <span class="value">{{ detail.orderTime }}</span>
      </div>
      <div class="item">
        <span class="key">{{ $t('message.paytime') }}：</span>
        <span class="value">{{ detail.payTime }}</span>
      </div>
      <div class="item">
        <span class="key">{{ $t('message.ddje') }}：</span>
        <span class="value">{{ detail.orderPrice }}</span>
      </div>
      <div class="item">
        <span class="key">{{ $t('message.zffs') }}：</span>
        <span class="value">{{ detail.payMethod || '-' }}</span>
      </div>
      <div class="item">
        <span class="key">{{ $t('message.zfdh') }}：</span>
        <span class="value">{{ detail.orderNum || '-' }}</span>
      </div>
      <div class="item">
        <span class="key">{{ $t('message.wcsj') }}：</span>
        <span class="value">{{ detail.finishTime || '-' }}</span>
      </div>
      <div v-if="detail.refundPrice || detail.refundPrice == 0" class="item">
        <span class="key">{{ $t('message.tkje') }}：</span>
        <span class="value">{{ $t('message.rmbfh') }}{{ detail.refundPrice }}</span>
      </div>
      <div v-if="detail.refundUser" class="item">
        <span class="key">{{ $t('message.tkclr') }}：</span>
        <span class="value">{{ detail.refundUser }}</span>
      </div>
    </div>
    <div class="line-style mb20" />
    <div class="property-title">{{ $t('message.kpqk') }}</div>
    <div class="df_ac">
      <div>
        <span class="key">{{ $t('message.kpzt') }}：</span>
        <span class="value">{{ detail.invoiceStatus }}</span>
      </div>
      <div>
        <span class="key">{{ $t('message.kpzt') }}：</span>
        <span class="value">{{ detail.invoiceTime || "-" }}</span>
      </div>
    </div>
    <div class="line-style mb20" />
    <div class="property-title">{{ $t('message.mjxx') }}</div>
    <div class="df_ac mt20">
      <div>
        <span class="key">{{ $t('message.name') }}：</span>
        <span class="value">{{ detail.memberName || '-' }}</span>
      </div>
      <div>
        <span class="key">{{ $t('message.lxdh') }}：</span>
        <span class="value">{{ detail.memberPhone || '-' }}</span>
      </div>
      <div>
        <span class="key">{{ $t('message.hykh') }}：</span>
        <span class="value">{{ detail.memberId || '-' }}</span>
      </div>
    </div>
    <div class="line-style mb20" />
    <el-table
      :data="detail.orderDetailList"
      border
      fit
      :header-row-class-name="'table-header'"
      class="doumee-element-table"
    >
      <el-table-column
        align="center"
        :label="$t('message.spmc')"
        prop="productName"
        min-width="120"
        show-overflow-tooltip
      />
      <el-table-column
        align="center"
        :label="$t('message.num')"
        prop="num"
        min-width="100"
        show-overflow-tooltip
      />
      <el-table-column
        align="center"
        :label="$t('message.xsjy')"
        prop="price"
        min-width="100"
        show-overflow-tooltip
      />
      <el-table-column
        align="center"
        :label="$t('message.xjy')"
        prop="sum"
        min-width="100"
        show-overflow-tooltip
      />
      <el-table-column
        align="center"
        :label="$t('message.status')"
        prop="status"
        min-width="100"
        show-overflow-tooltip
      />
    </el-table>
    <div class="bottom_wrap">
      <div class="line">
        <span>{{ $t('message.ddje') }}</span>
        <span>{{ detail.detailMoneyRespParam.orderPrice || 0 }}</span>
        <span>{{ $t('message.yuan') }}</span>
      </div>
      <template v-if="detail.detailMoneyRespParam">
        <div v-if="detail.detailMoneyRespParam.memberDiscount" class="line">
          <span>{{ $t('message.hydk') }}：</span>
          <span>-</span>
          <span>{{ detail.detailMoneyRespParam.memberDiscount || 0 }}</span>
          <span>{{ $t('message.yuan') }}</span>
        </div>
        <div v-if="detail.detailMoneyRespParam.marketingPolicy" class="line">
          <span>{{ $t('message.yxzc') }}：</span>
          <span>-</span>
          <span>{{ detail.detailMoneyRespParam.marketingPolicy || 0 }}</span>
          <span>{{ $t('message.yuan') }}</span>
        </div>
        <div v-if="detail.detailMoneyRespParam.groupBuyCoupon" class="line">
          <span>{{ $t('message.tgj') }}：</span>
          <span>-</span>
          <span>{{ detail.detailMoneyRespParam.groupBuyCoupon || 0 }}</span>
          <span>{{ $t('message.yuan') }}</span>
        </div>
        <div v-if="detail.detailMoneyRespParam.discountCoupon" class="line">
          <span>{{ $t('message.yhj') }}：</span>
          <span>-</span>
          <span>{{ detail.detailMoneyRespParam.discountCoupon || 0 }}</span>
          <span>{{ $t('message.yuan') }}</span>
        </div>
        <div v-if="detail.detailMoneyRespParam.integral" class="line">
          <span>{{ $t('message.jfdk') }}：</span>
          <span>-</span>
          <span>{{ detail.detailMoneyRespParam.integral || 0 }}</span>
          <span>{{ $t('message.yuan') }}</span>
        </div>
      </template>
      <div class="line secondColor">
        <span>{{ $t('message.sfk') }}：</span>
        <span>{{ detail.detailMoneyRespParam.getPrice || 0 }}</span>
        <span>{{ $t('message.yuan') }}</span>
      </div>
    </div>
  </el-drawer>
</template>

<script>
import store from '@/store'
import { momMOrderDetail } from '@/api'
export default {
  data() {
    return {
      isShow: false,
      detail: {},
      statusMap: {
        '0': this.$t('message.dzf'),
        '1': this.$t('message.cswzf'),
        '2': this.$t('message.qxzf'),
        '3': this.$t('message.zfcg'),
        '4': this.$t('message.tkz'),
        '5': this.$t('message.tkcg')
      },
      modalDialog: store.getters.dialog
    }
  },
  methods: {
    getOrderDetail(id) {
      momMOrderDetail({ param: { id }}).then(res => {
        this.detail = { ...res.record }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.df_ac {
  flex-wrap: wrap;
  div {
    width: 33.33%;
    margin-bottom: 20px;
    .key {
  color: #666666;
  display: inline-block;
  // width: 90px;
  // text-align: right;
}
.value {
  color: #222;
}
  }
}
.bottom_wrap {
  margin-top: 30px;
  text-align: right;
  .line {
    margin-bottom: 10px;
  }
}
</style>
